<template>
  首页
</template>
<script setup>
import {computed, ref} from "vue";
import {useRoute} from "vue-router";
import {useUserStore} from "@/store/userStore.js";
import {storeToRefs} from "pinia";

const map = {
  '/user':['用户管理','用户列表'],
  '/vehicle':['车辆管理','基本信息'],
  '/geofence':['电子围栏','围栏管理'],
  '/application':['调度管理','申请列表'],
  '/audit':['调度管理','调度审核'],
  '/distribute':['调度管理','车辆分配'],
  '/dict':['数据字典','字典管理'],
  '/checkIn':['入退管理','入住管理'],
  '/backDown':['入退管理','退住管理'],
  '/nurseProject':['护理管理','护理项目'],
  '/nursePlan':['护理管理','护理计划']
}

const route = useRoute();
const isCollapse = ref(false);
const {userInfo:user} = storeToRefs(useUserStore());
const breadCrumb = ref(map[route.path])
const userStore = useUserStore();



const menuWidthByCollapse = computed(()=>{
  return isCollapse.value ? '64px' : '208px';
})

const selectMenu = (index)=>{
  breadCrumb.value = map[index]
}

const changeCollapse=()=>{
  isCollapse.value = !isCollapse.value;
}

// 退出登录
const logout =async () => {
  // if(confirm("是否退出登录?")){
  //   localStorage.removeItem("user");
  //   window.location.href="/loginApi";
  //   user.value = {};
  // }
  await userStore.logoutAction()
}

</script>